/*
 * ImmutablePoint2D.java
 *
 * Created on Dec 14, 2007 at 6:07:03 PM
 *
 * Copyright 2009 the Desert Labs Project (http://desertlabs.us)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package us.desertlabs.visuals;

import java.awt.geom.Point2D;

/**
 * Represents an immutable pair of X and Y values, stored as <CODE>double</CODE>s.
 *
 * @author Brandon Franklin
 */
public class ImmutablePoint2D extends Point2D {

    /** The X value of this pair */
    private final double x;

    /** The Y value of this pair */
    private final double y;

    /**
     * Creates a new {@link ImmutablePoint2D} with the specified X and Y values.
     *
     * @param x the X value of the pair
     * @param y the Y value of the pair
     */
    public ImmutablePoint2D( final double x, final double y ) {
        this.x = x;
        this.y = y;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final double getX() {
        return x;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final double getY() {
        return y;
    }

    /**
     * This method is not supported, because instances of {@link ImmutablePoint2D} are immutable.
     *
     * @throws {@link UnsupportedOperationException} always
     */
    @Override
    public void setLocation( final double x, final double y ) {
        throw new UnsupportedOperationException(
                getClass().getSimpleName() + " is immutable, and therefore does not allow the location to be set." );
    }
}
